# -*- coding:utf-8 -*-
'''
# Author: xiguan
# Mail: xiguan.teng@qq.com
# -----
# Last Modified: 2022-05-13 10:03:47
# Modified By: xiguan
# -----
# Copyright (c) 2022 XiGuan Inc.
# 
# No Bug No error No warning.
# -----
'''

import config
from flask import Flask, render_template
from service.UserController import user
from service.SyncDir import syncdir
from service.Ignore import ignore
from service.Log import log
from service.FtpServer import ftpserver

# 注册蓝图
def register_all(app):
    app.register_blueprint(user, url_prefix='/user')
    app.register_blueprint(syncdir, url_prefix='/sync')
    app.register_blueprint(ignore, url_prefix='/ignore')
    app.register_blueprint(log, url_prefix='/log')
    app.register_blueprint(ftpserver, url_prefix='/ftp')


app = Flask(__name__)
# 开启调试模式，需要在 Configuration 中设置 FLASK_DEBUG 为 True
app.debug = True
# 模板修改后自动生效
app.jinja_env.auto_reload = True
# flask 秘钥字符串，任意字符串
app.config["SECRET_KEY"] = '123456'
# 配置数据库
app.config.from_object(config)


@app.route('/')
def go_login():
    print("/ success call")
    return render_template('login.html')


register_all(app)

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8880)